<?php $this->_extends('_layouts/main_layout'); ?>

<?php $this->_block('title'); ?>
My account
<?php $this->_endblock(); ?>

<?php $this->_block('keywords');?>
<meta name="keywords" content="<?php echo $site['keywords']; ?>" />
<?php $this->_endblock();?>

<?php $this->_block('description');?>
<meta name="description" content="<?php echo $site['description']; ?>" />
<?php $this->_endblock();?>

<?php $this->_block('content'); ?>

<div class="mm createaccount">
	<div class="topad">
		<?php echo str_replace('[[USER_ID]]', $user['id'], $site['ad_top']);?>
	</div>
	<div class="clear" style="height: 10px"></div>
	<div class="left" style="width: 600px;">
		<?php if(isset($infos)): ?>
			<ul class="infos">
				<?php foreach ($infos as $info):?>
				<li><?php echo $info;?></li>
				<?php endforeach;?>
			</ul>
		<?php endif;?>
		<div class="title">My account</div>
		<div class="clear" style="height: 10px"></div>
		<div class="left" style="width: 400px;">
			<div class="bold lh36">
				<span>User: </span><span class="f15"><?php echo $user['firstname'] . ' ' . $user['lastname']; ?></span>
			</div>
			<div class="bold lh36">
				<span>Number of Credits: </span><span class="f15"><?php echo $user['credit'] ;?></span>
			</div>
			<div class="bold lh36">
				<span>Current Holdings: </span><span class="f20">£<?php echo $user['balance'] ;?></span>
			</div>
		</div>
		<div class="right" style="width: 187px; display: none">
			<div class="sign">Sign in using Facebook Connect:</div>
			<div>
				<img src="<?php echo $img_url; ?>f.png" alt="" width="107"
					height="25" />
			</div>
			<div class="sign">Sign in using Twitter Connect:</div>
			<div>
				<img src="<?php echo $img_url; ?>t.png" alt="" width="107"
					height="25" />
			</div>
		</div>
		<div class="clear"></div>
		<div style="text-align: right" class="lh36">
			<a href="<?php echo url('user/profile'); ?>"><img src="<?php echo $img_url; ?>manageaccountbtn.png" alt=""
				width="184" height="29" /></a>&nbsp;&nbsp;<a href="<?php echo url('user/update'); ?>"><img
				src="<?php echo $img_url; ?>updatepasswordbtn.png" alt="" width="184"
				height="29" /></a>
		</div>
		<div class="lh30" style="text-align: right;">
			<?php if($user['balance'] >= 20):?>
				<a href="<?php echo url('user/fulfillment'); ?>"><img src="<?php echo $img_url; ?>getmymoney.png" /></a>
			<?php else: ?>
			You'll be eligible to receive your winnings once you collect £20
			<?php endif; ?>
		</div>
		<div class="bold f15 lh36">Your History</div>
		<div class="clear"></div>
		<div id="tabs">
			<div class="tab" id="history">
				<div class="item on" id="todayHistoryTab">Today</div>
				<div class="item off" id="weeklyHistoryTab">Weekly</div>
				<div class="item off" id="monthlyHistoryTab">Monthly</div>
				<div class="item off" id="allHistoryTab">All Time</div>
				<div class="clear"></div>
			</div>
			<div class="frame">
				<div class="t"></div>
				<div class="m">
					<div class="body left">
						<div class="tabs">
							<div class="th">
								<div class="lsqr left"></div>
								<div class="td" style="width: 272px;">Won</div>
								<div class="td last" style="width: 272px;">Credits Played</div>
								<div class="rsqr left"></div>
								<div class="clear"></div>
							</div>
							<div class="tr" id="todayHistory">
								<div class="lsqr left"></div>
								<div class="td" style="width: 272px;">£<?php echo $user['daily']; ?></div>
								<div class="td last" style="width: 272px;"><?php echo $user['daily_played']; ?></div>
								<div class="rsqr left"></div>
								<div class="clear"></div>
							</div>
							<div class="tr hidden" id="weeklyHistory">
								<div class="lsqr left"></div>
								<div class="td" style="width: 272px;">£<?php echo $user['weekly']; ?></div>
								<div class="td last" style="width: 272px;"><?php echo $user['weekly_played']; ?></div>
								<div class="rsqr left"></div>
								<div class="clear"></div>
							</div>
							<div class="tr hidden" id="monthlyHistory">
								<div class="lsqr left"></div>
								<div class="td" style="width: 272px;">£<?php echo $user['monthly']; ?></div>
								<div class="td last" style="width: 272px;"><?php echo $user['monthly_played']; ?></div>
								<div class="rsqr left"></div>
								<div class="clear"></div>
							</div>
							<div class="tr hidden" id="allHistory">
								<div class="lsqr left"></div>
								<div class="td" style="width: 272px;">£<?php echo $user['won']; ?></div>
								<div class="td last" style="width: 272px;"><?php echo $user['played']; ?></div>
								<div class="rsqr left"></div>
								<div class="clear"></div>
							</div>
							<div class="foot"></div>
						</div>
					</div>
					<div class="clear"></div>
				</div>
				<div class="b"></div>
			</div>
		</div>
		<div class="clear lh30">&nbsp;</div>
		<div class="bold f15 lh30">Offers</div>
		<div id="tabs">
			<div class="tab" id="offer">
				<div class="item on" id="todayOffersTab">Today</div>
				<div class="item off" id="weeklyOffersTab">Weekly</div>
				<div class="item off" id="monthlyOffersTab">Monthly</div>
				<div class="item off" id="allOffersTab">All Time</div>
				<div class="clear"></div>
			</div>
			<div class="frame">
				<div class="t"></div>
				<div class="m">
					<div class="body left">
						<div class="tabs">
							<div class="th">
								<div class="lsqr left"></div>
								<div class="td" style="width: 120px;">Date Completed</div>
								<div class="td" style="width: 323px;">Offer</div>
								<div class="td last" style="width: 100px;">Credits</div>
								<div class="rsqr left"></div>
								<div class="clear"></div>
							</div>
							<div id="offerslist">
								<?php 		
									if(!empty($user['offers'])):
										foreach ($user['offers'] as $offer):
								?>
									<div class="tr<?php echo (TimeUtil::checkIsTheSameDay(time(), $offer['created'])) ? '' : ' hidden';?>">
										<div class="lsqr left"></div>
										<div class="td" style="width: 120px;"><?php echo date('M j, Y', $offer['created'])?></div>
										<div class="td" style="width: 323px;"><?php echo substr($offer['name'], 0, 30) . ((strlen($offer['name']) > 30)? '...' : ''); ?></div>
										<div class="td last" style="width: 100px;"><?php echo $offer['credit']; ?></div>
										<div class="rsqr left"></div>
										<div class="clear"></div>
									</div>
										<?php endforeach; ?>
									<?php endif;?>
							</div>
							<div class="foot"></div>
						</div>
					</div>
					<div class="clear"></div>
				</div>
				<div class="b"></div>
			</div>
		</div>
	</div>
	<div class="right rightad">
		<?php $this->_element('rightad'); ?>
	</div>
	<div class="clear" style="height: 50px;"></div>
	<div class="bottomad">
		<?php echo $site['ad_bottom']; ?>
	</div>
</div>
<div class="mb"></div>
<?php $this->_endblock(); ?>